<HTML><HEAD><TITLE>nth1(?I, ?List, -Elem, -Rest)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(listut)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>nth1(?I, ?List, -Elem, -Rest)</H1>
Access nth element and remainder of a list
<DL>
<DT><EM>I</EM></DT>
<DD>Integer position index, counting from 1
</DD>
<DT><EM>List</EM></DT>
<DD>A list
</DD>
<DT><EM>Elem</EM></DT>
<DD>Any term
</DD>
<DT><EM>Rest</EM></DT>
<DD>A list
</DD>
</DL>
<H2>Description</H2>
	Unifies Elem with the Nth element of List, counting from 1,
	and Rest with the other elements.  It can be used to select
	the Nth element of List (yielding Elem and Rest), or to insert
	Elem before the Nth (counting from 1) element of Rest, when it
	yields List, e.g. nth1(3, List, c, [a,b,d,e]) unifies List
	with [a,b,c,d,e].
    
<H3>Modes and Determinism</H3><UL>
<LI>nth1(+, +, -, -) is det
<LI>nth1(-, +, -, -) is nondet
<LI>nth1(-, -, -, -) is nondet
</UL>
<H2>See Also</H2>
<A HREF="../../lib_public/listut/nth0-3.html">nth0 / 3</A>, <A HREF="../../lib_public/listut/nth1-3.html">nth1 / 3</A>, <A HREF="../../lib_public/listut/nth0-4.html">nth0 / 4</A>
</BODY></HTML>
